Learn R Programming

stremo (version 0.2)

Multivariate Normal: Random multivariate normal distribution.

Description

This function returns a set of uncorrelated variables following a normal distribution.

Usage

rmnorm(covmat, means = 0, sds = NULL, n)

Arguments

covmat
Covariance matrix to be decomposed.
means
A vector of means. If 0 data are centred. Otherwise, its size must be equal in length to the number of variables in covmat.
sds
Optional vector of standard deviations. Must also have length equal to the number of variables in covmat.
n
Number of observations.

Value

A matrix.

References

Fan, X. and Fan, X. Using SAS for Monte Carlo Simulation Research in SEM. 2005. Structural Equation Modeling 12(2): 299-333.

Examples

Run this code
data(latta)
mat <- rmnorm(latta.greenhouse.cov, n = 1000)
mat
latta.greenhouse.cov
cov(mat)

Run the code above in your browser using DataLab